+Mon Aug 30 01:34:42 2004 Matthias Clasen <maclas@gmx.de>
+
+ Changes to make sure input methods respect the editability
+ of entries and text views. #114173, Noah Levitt.
+
+ * gtk/gtkentry.c (popup_targets_received): Make the Input
+ Methods menuitem insensitive if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_delete_surrounding_cb):
+ * gtk/gtkentry.c (gtk_entry_preedit_changed_cb):
+ * gtk/gtkentry.c (gtk_entry_commit_cb): Don't change anything
+ if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_focus_out):
+ * gtk/gtkentry.c (gtk_entry_focus_in): Only send focus_in and
+ focus_out to the im context if we're editable.
+
+ * gtk/gtkentry.c (gtk_entry_set_property): Reset the im context
+ if the entry just became non-editable.
+
+ * gtk/gtktextview.c (gtk_text_view_delete_surrounding_handler):
+ Use gtk_text_buffer_delete_interactive() to not delete
+ non-editable portions of text.
+
2004-08-30 Tor Lillqvist <tml@iki.fi>
* modules/input/Makefile.am (im_ime_la_LIBADD): Link with -limm32.
+Mon Aug 30 01:34:42 2004 Matthias Clasen <maclas@gmx.de>
+
+ Changes to make sure input methods respect the editability
+ of entries and text views. #114173, Noah Levitt.
+
+ * gtk/gtkentry.c (popup_targets_received): Make the Input
+ Methods menuitem insensitive if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_delete_surrounding_cb):
+ * gtk/gtkentry.c (gtk_entry_preedit_changed_cb):
+ * gtk/gtkentry.c (gtk_entry_commit_cb): Don't change anything
+ if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_focus_out):
+ * gtk/gtkentry.c (gtk_entry_focus_in): Only send focus_in and
+ focus_out to the im context if we're editable.
+
+ * gtk/gtkentry.c (gtk_entry_set_property): Reset the im context
+ if the entry just became non-editable.
+
+ * gtk/gtktextview.c (gtk_text_view_delete_surrounding_handler):
+ Use gtk_text_buffer_delete_interactive() to not delete
+ non-editable portions of text.
+
2004-08-30 Tor Lillqvist <tml@iki.fi>
* modules/input/Makefile.am (im_ime_la_LIBADD): Link with -limm32.
+Mon Aug 30 01:34:42 2004 Matthias Clasen <maclas@gmx.de>
+
+ Changes to make sure input methods respect the editability
+ of entries and text views. #114173, Noah Levitt.
+
+ * gtk/gtkentry.c (popup_targets_received): Make the Input
+ Methods menuitem insensitive if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_delete_surrounding_cb):
+ * gtk/gtkentry.c (gtk_entry_preedit_changed_cb):
+ * gtk/gtkentry.c (gtk_entry_commit_cb): Don't change anything
+ if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_focus_out):
+ * gtk/gtkentry.c (gtk_entry_focus_in): Only send focus_in and
+ focus_out to the im context if we're editable.
+
+ * gtk/gtkentry.c (gtk_entry_set_property): Reset the im context
+ if the entry just became non-editable.
+
+ * gtk/gtktextview.c (gtk_text_view_delete_surrounding_handler):
+ Use gtk_text_buffer_delete_interactive() to not delete
+ non-editable portions of text.
+
2004-08-30 Tor Lillqvist <tml@iki.fi>
* modules/input/Makefile.am (im_ime_la_LIBADD): Link with -limm32.
+Mon Aug 30 01:34:42 2004 Matthias Clasen <maclas@gmx.de>
+
+ Changes to make sure input methods respect the editability
+ of entries and text views. #114173, Noah Levitt.
+
+ * gtk/gtkentry.c (popup_targets_received): Make the Input
+ Methods menuitem insensitive if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_delete_surrounding_cb):
+ * gtk/gtkentry.c (gtk_entry_preedit_changed_cb):
+ * gtk/gtkentry.c (gtk_entry_commit_cb): Don't change anything
+ if we're not editable.
+
+ * gtk/gtkentry.c (gtk_entry_focus_out):
+ * gtk/gtkentry.c (gtk_entry_focus_in): Only send focus_in and
+ focus_out to the im context if we're editable.
+
+ * gtk/gtkentry.c (gtk_entry_set_property): Reset the im context
+ if the entry just became non-editable.
+
+ * gtk/gtktextview.c (gtk_text_view_delete_surrounding_handler):
+ Use gtk_text_buffer_delete_interactive() to not delete
+ non-editable portions of text.
+
2004-08-30 Tor Lillqvist <tml@iki.fi>
* modules/input/Makefile.am (im_ime_la_LIBADD): Link with -limm32.
if (new_value != entry->editable)
{
+ if (!new_value)
+ {
+ gtk_entry_reset_im_context (entry);
+ if (GTK_WIDGET_HAS_FOCUS (entry))
+ gtk_im_context_focus_out (entry->im_context);
+
+ entry->preedit_length = 0;
+ entry->preedit_cursor = 0;
+ }
+
entry->editable = new_value;
- gtk_entry_queue_draw (entry);
- if (!entry->editable)
- gtk_entry_reset_im_context (entry);
+ if (new_value && GTK_WIDGET_HAS_FOCUS (entry))
+ gtk_im_context_focus_in (entry->im_context);
+
+ gtk_entry_queue_draw (entry);
}
}
break;
gtk_widget_queue_draw (widget);
- entry->need_im_reset = TRUE;
- gtk_im_context_focus_in (entry->im_context);
+ if (entry->editable)
+ {
+ entry->need_im_reset = TRUE;
+ gtk_im_context_focus_in (entry->im_context);
+ }
g_signal_connect (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
"direction_changed",
gtk_widget_queue_draw (widget);
- entry->need_im_reset = TRUE;
- gtk_im_context_focus_out (entry->im_context);
+ if (entry->editable)
+ {
+ entry->need_im_reset = TRUE;
+ gtk_im_context_focus_out (entry->im_context);
+ }
gtk_entry_check_cursor_blink (entry);
const gchar *str,
GtkEntry *entry)
{
- gtk_entry_enter_text (entry, str);
+ if (entry->editable)
+ gtk_entry_enter_text (entry, str);
}
static void
gtk_entry_preedit_changed_cb (GtkIMContext *context,
GtkEntry *entry)
{
- gchar *preedit_string;
- gint cursor_pos;
-
- gtk_im_context_get_preedit_string (entry->im_context,
- &preedit_string, NULL,
- &cursor_pos);
- entry->preedit_length = strlen (preedit_string);
- cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1));
- entry->preedit_cursor = cursor_pos;
- g_free (preedit_string);
-
- gtk_entry_recompute (entry);
+ if (entry->editable)
+ {
+ gchar *preedit_string;
+ gint cursor_pos;
+
+ gtk_im_context_get_preedit_string (entry->im_context,
+ &preedit_string, NULL,
+ &cursor_pos);
+ entry->preedit_length = strlen (preedit_string);
+ cursor_pos = CLAMP (cursor_pos, 0, g_utf8_strlen (preedit_string, -1));
+ entry->preedit_cursor = cursor_pos;
+ g_free (preedit_string);
+
+ gtk_entry_recompute (entry);
+ }
}
static gboolean
gint n_chars,
GtkEntry *entry)
{
- gtk_editable_delete_text (GTK_EDITABLE (entry),
- entry->current_pos + offset,
- entry->current_pos + offset + n_chars);
+ if (entry->editable)
+ gtk_editable_delete_text (GTK_EDITABLE (entry),
+ entry->current_pos + offset,
+ entry->current_pos + offset + n_chars);
return TRUE;
}
gtk_menu_shell_append (GTK_MENU_SHELL (entry->popup_menu), menuitem);
menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
+ gtk_widget_set_sensitive (menuitem, entry->editable);
gtk_widget_show (menuitem);
submenu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
gtk_text_iter_forward_chars (&start, offset);
gtk_text_iter_forward_chars (&end, offset + n_chars);
- gtk_text_buffer_delete (text_view->buffer, &start, &end);
+ gtk_text_buffer_delete_interactive (text_view->buffer, &start, &end);
return TRUE;
}